Skip to content

refactor: Fix header styling issues - #1292

Merged
rschristian merged 7 commits into
masterfrom
refactor/header-styling2
Jun 11, 2025
Merged

refactor: Fix header styling issues#1292
rschristian merged 7 commits into
masterfrom
refactor/header-styling2

Conversation

@rschristian

Copy link
Copy Markdown
Member

Will review & explain the changes one-by-one below, but looks to fix a handful of issues that have crept up. None are too problematic but good opportunity to review & fix some things.

Comment on lines -258 to -263
z-index: 101;

svg {
filter: invert(40%) sepia(0%) saturate(3773%) hue-rotate(315deg)
brightness(73%) contrast(81%);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The z-index is entirely unused, goes back to the repo creation. This style would only apply to the 'About' or i18n dropdown buttons which wouldn't need a z-index as they're kept inline, exactly where they were.

The SVG filter is a far more complex method of updating the icon color; way easier to just switch the icon to use currentColor and piggyback off the color setting just a few lines up (color: #555).

@rschristian rschristian changed the title refactor: Simplify i18n color change on drop down refactor: Fix header styling issues Jun 10, 2025
fill: rgba(255, 255, 255, 0.6);
cursor: pointer;
z-index: 560;
z-index: 460;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a typo.

The slide-out sidebar has a z-index of 450, and the slide-down header has a z-index of 500. As such, when the header is expanded, there's really no reason for the sidebar toggle button to be displayed -- you're toggling something that can't be seen.

z-index of 460 allows it to still sit on top of the sidebar when expanded but hidden behind the header if it is expanded.

Comment on lines -32 to +34
height: var(--vh);
height: calc(var(--vh) - var(--banner-height));

@rschristian rschristian Jun 10, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Predates my involvement, but IIUC, this was a problem introduced when the banner was added. It seems like the idea was that the social icons would be at the bottom of the screen when the togglable header was expanded, however, it never took into account the banner height. As such, the icons were always clipped off the screen.

The handful of white pixels at the very bottom of the screen are our icons, but you obviously can't interact with them as-is.

Screenshot of the site on a mobile device with the header expanded. Shows just the very top of icons (a handful of pixels at most)

Comment on lines -97 to -101
position: relative;
display: inline-block;
font-size: 100%;
user-select: none;
-webkit-user-drag: none;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT, completely unnecessary.

font-size: 100%;
user-select: none;
-webkit-user-drag: none;
display: flex;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue of header items wrapping on some screensizes:

Screenshot of the site at a width of 900px. The header nav items wrap so that the 'REPL' link is pushed out of the header and on top of the page content

Still not perfect, there's now some overlapping in the header, but wrapping is very bad.

Comment on lines +186 to +187
display: flex;
align-items: center;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensures the little dropdown arrow next to 'About' (or any future dropdown pages) is vertically centered:

Screenshot of the site header. There's a triangular dropdown arrow next to the 'About' link, but it's a bit lower than center compared to the label

Comment on lines +310 to +311
touch-action: none;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the header is opened, we should not let the user scroll the page in the background.

Comment on lines -330 to +327
top: calc(var(--vh) - 3rem); /* TODO: Why does bottom not work? */
display: flex;
display: none;
bottom: calc(env(safe-area-inset-bottom) + 1rem);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hides the icons by default and uses the more straightforward bottom now that our parent height has been corrected (see comment above).

What it looks like now:

Screenshot of header expanded on mobile. The social icons now sit within the viewport at the bottom of the screen

padding: 18px 23px 12px;
line-height: var(--header-height);
text-align: center;
z-index: 100;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superfluous z-index, it sits on the header (z-index of 500 already) and nothing overlaps it either.

@rschristian
rschristian marked this pull request as ready for review June 10, 2025 21:37

@marvinhagemeister marvinhagemeister left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All great fixes! Quality work as usual 👍

@rschristian
rschristian merged commit 2d3a9f8 into master Jun 11, 2025
4 checks passed
@rschristian
rschristian deleted the refactor/header-styling2 branch June 11, 2025 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants